<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" isELIgnored="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>注册</title>
<%-- <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>--%>
	<script src="${pageContext.request.contextPath}/static/js/jQuery.js"></script>
</head>
<body>
<center>
	<table>
		<tr>
			<td>用户名：</td>
			<td><input type="text" id="username" name="username"></td>
		</tr>
		<tr>
			<td>密码：</td>
			<td><input type="password" id="password" name="password"></td>
		</tr>
		<tr>
			<td colspan="2"><button id="register">注册</button></td>
		</tr>
	</table>
</center>

<a href="register?username=root&password=root" >点击get请求</a>

<script type="text/javascript">
	$(function () {
		$("#register").click(function () {
			console.log("点击按钮");
			var username=$('#username').val().trim();
			var password=$('#password').val().trim();
			$.ajax({
				url:'register',
				data:{'username':username,'password':password},
				type:'post',
				success:function(res){
					if(res=='success'){
						console.log("注册成功");
						alert("注册成功");
					}else{
						console.log("注册成功");
						alert("注册失败");
					}
				}
			});
		})


	});

</script>
</body>
</html>